package com.mobile.handler;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.mobile.common.base.handler.BaseHandler;
import com.mobile.common.base.hibernate.SimpleDao;
import com.mobile.common.base.support.Page;
import com.mobile.persistent.dao.UserDao;
import com.mobile.persistent.entity.Users;

@Service
public class UsersHandler extends BaseHandler<Users, Long> {

	@Resource 
	private UserDao userDao;
	
	@Override
	public SimpleDao<Users,Long> getEntityDao() {
		return userDao;
	}

	public Page<Users> findPageByCriteria(Users search, int pageNo, int pageSize){
		return userDao.findPageByCriteria(search, pageNo, pageSize);
	}
	
	public Page<Users> findPageByHql(Users search, int pageNo, int pageSize){
		return userDao.findPageByHql(search, pageNo, pageSize);
	}
	
	// 根据用户名和密码获取用户信息
	public Users findByNamePwd(String userName, String userPwd){
		return userDao.findByNamePwd(userName, userPwd);
	}
	
}
